package com.Bigbluebook.Service;

import com.Bigbluebook.entity.Comment;
import com.Bigbluebook.entity.Post;
import com.Bigbluebook.entity.PostsInfo;

import java.util.List;

import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.DELETE;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.PUT;
import retrofit2.http.Path;

public interface PostService {
    @POST("posts")
    Call<Post> createPost(@Body Post post);

    @GET("posts/{id}")
    Call<Post> getPost(@Path("id") int postId);

    @GET("posts")
    Call<List<Post>> getAllPosts();

    @PUT("posts/{id}")
    Call<Post> updatePost(@Path("id") int postId, @Body Post post);

    @DELETE("posts/{id}")
    Call<Void> deletePost(@Path("id") int postId);

    // 获取帖子详情
    @GET("posts/{id}")
    Call<PostsInfo> getPostById(@Path("id") int postId);

    // 获取帖子评论
    @GET("comments/posts/{id}/comments")
    Call<List<Comment>> getCommentsByPostId(@Path("id") int postId);

    @GET("posts/{id}/likes/count")
    Call<Long> getLikesCount(@Path("id") int postId);

    @GET("posts/{id}/stars/count")
    Call<Long> getStarsCount(@Path("id") int postId);
}
